using System;
using System.Collections.Generic;
using System.Drawing;
using NobleTech.Products.CreatureKingdom.Utils;

namespace NobleTech.Products.CreatureKingdom
{
    /// <summary>
    /// A basic renderer that just represents your Organism as a coloured sphere
    /// </summary>
    public class SphereRenderer : IRenderer
    {
        public SphereRenderer(OrganismStats stats)
        {
        }

        public virtual void Render(OrganismInfo info, PointD location, double directionFacing, Graphics g)
        {
            Brush brush = new SolidBrush(info.Colour);
            // Draw my position
            RectangleD area = new RectangleD(location, info.Size);
            g.FillEllipse(brush, (RectangleF)area);
            // Put a dot to show which way it's facing
            RectangleD nose = new RectangleD(
                location + SizeD.FromAngle(directionFacing, info.Size), info.Size / 4);
            g.FillEllipse(brush, (RectangleF)nose);
            // Put a black outline around dead Organisms
            if (!info.Alive)
                g.DrawEllipse(Pens.Black, (RectangleF)area);
        }
    }
}
